package main.com.hushengjin.demo;

import main.com.hushengjin.model.Shape;
import main.com.hushengjin.factory.ShapeFactory;

public class FactoryPatternDemo {

    public static void main(String[] args){
        ShapeFactory shapeFactory = new ShapeFactory();

        //获取Circle对象，并调用他的draw方法
        Shape circle = shapeFactory.getShape("CIRCLE");

        //调用circle的draw方法
        circle.draw();

        //获取rectangle对象，并调用他的draw方法
        Shape rectangle = shapeFactory.getShape("RECTANGLE");

        //调用rectangle的draw方法
        rectangle.draw();

        //获取square对象，并调用他的draw方法
        Shape square = shapeFactory.getShape("Square");

        //调用square的draw方法
        square.draw();
    }

}
